home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / private / _getcbrk.c < prev    next >
C/C++ Source or Header  |  1993-06-18  |  2KB  |  96 lines

  1. #define    CURSES_LIBRARY    1
  2. #define NEEDS_OS2       1
  3. #include <curses.h>
  4.  
  5. #ifdef PDCDEBUG
  6. char *rcsid__getcbrk = "$Header: C:\CURSES\private\RCS\_getcbrk.c 2.1 1993/06/18 20:22:43 MH Rel MH $";
  7. #endif
  8.  
  9. #ifdef OS2
  10. #  if defined(CURSES__32BIT__) || defined(CSET2) || defined(TC)
  11. #     include <signal.h>
  12. #  else
  13. #     define INCL_DOSSIGNALS
  14. #     define INCL_NOCOMMON
  15. #     include <bsedos.h>
  16. #  endif
  17. #endif
  18.  
  19.  
  20. /*man-start*********************************************************************
  21.  
  22.   PDC_get_ctrl_break()    - return OS control break state
  23.  
  24.   PDCurses Description:
  25.      This is a private PDCurses routine.
  26.  
  27.      Returns the current OS Control Break Check state.
  28.  
  29.   PDCurses Return Value:
  30.      DOS:
  31.          This function returns TRUE on if the Control Break
  32.          Check is enabled otherwise FALSE is returned.
  33.  
  34.      FLEXOS:
  35.          This function returns TRUE on if the Keyboard Mode
  36.          allows a break to bre reported otherwise FALSE is returned.
  37.  
  38.   PDCurses Errors:
  39.      No errors are defined for this function.
  40.  
  41.   Portability:
  42.      PDCurses    bool    PDC_get_ctrl_break( void );
  43.  
  44. **man-end**********************************************************************/
  45.  
  46. bool    PDC_get_ctrl_break(void)
  47. {
  48. #ifdef    OS2
  49. #  if defined(CURSES__32BIT__) || defined(CSET2) || defined(TC)
  50. #     if defined(TC)
  51.     void __cdecl (*oldAction) (int);
  52. #     else
  53.     void (*oldAction) (int);
  54. #     endif
  55. #  endif
  56. #endif
  57.  
  58. #ifdef PDCDEBUG
  59.     if (trace_on) PDC_debug("PDC_get_ctrl_break() - called\n");
  60. #endif
  61.  
  62. #ifdef    FLEXOS
  63.     return ((kbmode & 0x01) ? TRUE : FALSE);
  64. #endif
  65.  
  66. #ifdef    DOS
  67.     regs.h.ah = 0x33;
  68.     regs.h.al = 0x00;
  69.     int86(0x21, ®s, ®s);
  70.     return ((bool) regs.h.dl);
  71. #endif
  72.  
  73. #ifdef    OS2
  74. #  if defined(CURSES__32BIT__) || defined(CSET2) || defined(TC)
  75.     oldAction = signal (SIGINT, SIG_DFL);
  76.     if (oldAction == SIG_ERR) return FALSE;
  77.     else signal (SIGINT, oldAction);
  78.     return (oldAction != SIG_IGN);
  79. #  else
  80.     PFNSIGHANDLER oldHandler, oldHandler1;
  81.     USHORT oldAction, oldAction1;
  82.     /* get the current state, and set to ignore */
  83.     DosSetSigHandler((PFNSIGHANDLER) NULL, &oldHandler, &oldAction,
  84.         SIGA_IGNORE, SIG_CTRLBREAK);
  85.     /* restore the previous state */
  86.     DosSetSigHandler(oldHandler, &oldHandler1, &oldAction1,
  87.         oldAction, SIG_CTRLBREAK);
  88.     return(oldAction != SIGA_IGNORE);
  89. #  endif
  90. #endif
  91.  
  92. #ifdef UNIX
  93. /* INCOMPLETE - use signals?*/
  94. #endif
  95. }
  96.